package com.xlabs.client;

import java.util.List;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.xlabs.client.DTO.QuestionDTO;
import com.xlabs.client.DTO.ReplyDTO;
import com.xlabs.client.DTO.TransferDTO;

/**
 * TimedCommentService class.
 */
@RemoteServiceRelativePath("CommentingService")
public interface CommentingService extends RemoteService {
    /**
     * Posts comment for a video.
     *
     * @param comment comment text.
     * @param time    time of comment.
     * @param currentVideoId video id.
     */
    public void postQuestion(String comment, int time, String currentVideoId);
    
    /**
     * Gets all comments for the given video that were posted interval seconds from the given time. 
     * @param videoId video id.
     * @param time the time for which the questions will be extracted. 
     * @param interval half of the length of the interval for which the questions will be extracted.
     * @param async callback.
     */
    public QuestionDTO[] getQuestionsInSymmetricTimeInterval(String videoId, int time, int interval);
    
	/**
	 * Gets questions asked in a given time interval.
	 * @param videoId video id.
	 * @param startTimeIndex start time 
	 * @param endTimeIndex end time.
	 * @param direction specifies the direction of query.  
	 * @param pageSize how many questions to return. 
	 * @param asyncCallBack callback method.
	 * @return transfer object including the questions.
	 */
    public TransferDTO getPagedQuestionsWithStartTimeInInterval(
    		String videoId, 
    		String startTimeIndex, 
    		String endTimeIndex, 
    		int direction, 
    		int pageSize);
    
	/**
	 * Gets questions asked around the given time.
	 * @param videoId video id.
	 * @param time input time.
	 * @param pageSize how many questions to return.
	 * @return transfer object containing the questions. 
	 */
    public TransferDTO getPagedQuestionsWithStartTimeAroundTime(
			String videoId, 
			int time,
			int pageSize);

    /**
     * Posts a reply for a question.
     *
     * @param reply       reply.
     * @param questionKey question key.
     */
    public void postReply(String reply, String questionKey);

    /**
     * Gets the conversation related to the question given.
     *
     * @param questionEncodedKey question's key.
     * @return conversation.
     */
    public List<ReplyDTO> getConversation(String questionEncodedKey);

    /**
     * Posts an inner reply for another reply in conversation.
     *
     * @param reply              reply.
     * @param parentReplyKey     question key.
     * @param questionEncodedKey corresponding question's encoded key
     */
    public void posInnertReply(String reply, String parentReplyKey, String questionEncodedKey);
}